//
//  HYRequestDefine.h
//  HYRealEstate
//
//  Created by 鲁志刚 on 2017/12/12.
//  Copyright © 2017年 MaiTianMM. All rights reserved.
//

#ifndef HYRequestDefine_h
#define HYRequestDefine_h

#define HYJudgeReturnValueResponseObject(responseObject) \
[self judgeReturnValueResponseObject:responseObject Success:^{ \
    if (successBlock) { \
        successBlock(responseObject);\
    }\
} fauile:^{\
    if (failure) {\
        failure(responseObject);\
    }\
}];\

#define HY_POST_URL(url,param) \
[HYRequestHelper POST:url parameters:param success:^(id responseObject) { \
    [self judgeReturnValueResponseObject:responseObject Success:^{ \
        if (successBlock) { \
            successBlock(responseObject); \
        } \
    } fauile:^{ \
        if (failure) { \
            failure(responseObject); \
        } \
}]; \
} failure:^(NSError *error, NSString *errorStr) { \
    if (errorBlock) { \
        errorBlock(error); \
    } \
}]; \

#define HY_GET_URL(url,param) \
[HYRequestHelper GET:url parameters:param success:^(id responseObject) { \
    [self judgeReturnValueResponseObject:responseObject Success:^{ \
        if (successBlock) { \
            successBlock(responseObject); \
        } \
    } fauile:^{ \
        if (failure) { \
            failure(responseObject); \
        } \
    }]; \
} failure:^(NSError *error, NSString *errorStr) { \
    if (errorBlock) { \
        errorBlock(error); \
    } \
}]; \

#define HY_GET_URL_V2(url,params,header) \
[HYRequestBaseHelper GET:url parameters:params headers:header success:^(id responseObject) {\
if ([responseObject HY_validHTTPResponse]) {\
if (successBlock) {\
successBlock(responseObject);\
}\
}else{\
if (failure) {\
failure(responseObject);\
}\
}\
} failure:^(NSError *error, NSString *errorStr) {\
if (failure) {\
failure(error);\
}\
}];\

#define HY_POST_URL_V2(url,params,header)\
[HYRequestBaseHelper POST:url  parameters:params headers:header success:^(id responseObject) {\
if ([responseObject HY_validHTTPResponse]) {\
if (successBlock) {\
successBlock(responseObject);\
}\
}else{\
if (failure) {\
failure(responseObject);\
}\
}\
} failure:^(NSError *error, NSString *errorStr) {\
if (failure) {\
failure(error);\
}\
}];\

#endif /* HYRequestDefine_h */
